import { handleUrlParams } from "../../../../utils";

export default {
  //纠错
  handleCorrectQuestion(structureId) {
    uni.navigateTo({
      url: handleUrlParams("/practice/pages/topicCorrection/index", {
        structureId: structureId,
      }),
    });
  },
  //根据optionList里面的选项判断该用户做对了 / 做错了 / 没做这道题
  handleOptionList(optionList) {
    let doRight = false;
    let noDo = true;
    optionList.forEach((item) => {
      if (item.userAnswer) {
        noDo = false
        if (item.answer) {
          doRight = true;
        }
      }
    });
    if (noDo) {
      return 'noDo';
    } else if (doRight) {
      return 'doRight';
    } else {
      return 'doWrong';
    }
  },
};
